using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shpm.App.Input.Bean;
using Shpm.App.Input.Dao;
using Shpm.App.Master.Bean;
using Shpm.App.Master.Dao;
using Shpm.App.Commons.Db.Beans.Master;
using Shpm.System;
using Shpm.App.Commons.Utils;
using System.Reflection;
using Shpm.System.Web.Control;
using log4net;

public partial class App_Input_DishPhotoForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            DishBean dataBean = new DishBean();
            DishBean newBean = new DishBean();
            DishDao Dao = new DishDao();
            dataBean.DishId = Convert.ToInt32(Request.QueryString["ID"]);
            newBean = Dao.GetDish(dataBean);
            if (newBean != null)
            {
                if (newBean.Photo != null)
                {
                    Response.ContentType = "image/*";
                    Response.BinaryWrite(newBean.Photo);
                    Response.Flush();
                }
                else
                {
                    string url = "~/images/blank.JPG";
                    ControllerUtils.Transfer(Context, url, true);
                }
            }
            else
            {
                string url = "~/images/blank.JPG";
                ControllerUtils.Transfer(Context, url, true);
            }
        }
        catch
        {
            string url = "~/images/blank.JPG";
            ControllerUtils.Transfer(Context, url, true);
        }
    }
}
